CREATE TABLE [dbo].[TMAUXI_CORP]
(
[TI_AUXI_CORP] [dbo].[TD_VC_001] NOT NULL,
[CO_AUXI_CORP] [dbo].[TD_VC_020] NOT NULL,
[AP_PATE_AUXI] [dbo].[TD_VC_020] NULL,
[AP_MATE_AUXI] [dbo].[TD_VC_020] NULL,
[NO_NATU_AUX1] [dbo].[TD_VC_020] NULL,
[NO_NATU_AUX2] [dbo].[TD_VC_020] NULL,
[NO_RAZO_SOCI] [dbo].[TD_VC_050] NULL,
[NO_AUXI] [dbo].[TD_VC_050] NOT NULL,
[NO_DIRE] [dbo].[TD_VC_100] NULL,
[CO_UBIC_GEOG] [dbo].[TD_VC_006] NULL,
[CO_PAIS] [dbo].[TD_VC_003] NULL,
[NU_RUCS] [dbo].[TD_VC_020] NULL,
[NU_TLFN] [dbo].[TD_VC_020] NULL,
[NU_FAXE] [dbo].[TD_VC_020] NULL,
[NO_REPR] [dbo].[TD_VC_050] NULL,
[CO_DOCU_SUNA] [dbo].[TD_VC_003] NULL,
[NU_DOCU_SUNA] [dbo].[TD_VC_020] NULL,
[TI_PERS_SUNA] [dbo].[TD_VC_003] NULL,
[NU_RETE_SUNA] [dbo].[TD_VC_020] NULL,
[TI_SITU] [dbo].[TD_VC_003] NOT NULL,
[ST_RETE] [dbo].[TD_VC_001_SINO] NULL,
[ST_BCON] [dbo].[TD_VC_001_SINO] NULL,
[CO_USUA_CREA] [dbo].[TD_VC_008_USUA] NULL CONSTRAINT [DF__TMAUXI_CO__CO_US__5BE2A6F2] DEFAULT (substring(suser_sname(),(1),(8))),
[FE_USUA_CREA] [dbo].[TD_DT_001_SIST] NULL CONSTRAINT [DF__TMAUXI_CO__FE_US__5CD6CB2B] DEFAULT (getdate()),
[CO_USUA_MODI] [dbo].[TD_VC_008_USUA] NULL CONSTRAINT [DF__TMAUXI_CO__CO_US__5DCAEF64] DEFAULT (substring(suser_sname(),(1),(8))),
[FE_USUA_MODI] [dbo].[TD_DT_001_SIST] NULL CONSTRAINT [DF__TMAUXI_CO__FE_US__5EBF139D] DEFAULT (getdate())
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TMAUXI_CORP] WITH NOCHECK ADD CONSTRAINT [CK__TMAUXI_CO__ST_BC__5AEE82B9] CHECK NOT FOR REPLICATION (([ST_BCON]='N' OR [ST_BCON]='S'))
GO
ALTER TABLE [dbo].[TMAUXI_CORP] WITH NOCHECK ADD CONSTRAINT [CK__TMAUXI_CO__ST_RE__59FA5E80] CHECK NOT FOR REPLICATION (([ST_RETE]='N' OR [ST_RETE]='S'))
GO
ALTER TABLE [dbo].[TMAUXI_CORP] ADD CONSTRAINT [PK__TMAUXI_C__CA0EADEF7A8729A3] PRIMARY KEY CLUSTERED  ([TI_AUXI_CORP], [CO_AUXI_CORP]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IM_AUXI_CORP_I01] ON [dbo].[TMAUXI_CORP] ([TI_AUXI_CORP]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TMAUXI_CORP] ADD CONSTRAINT [FK__TMAUXI_CO__CO_PA__31A25463] FOREIGN KEY ([CO_PAIS]) REFERENCES [dbo].[TTPAIS] ([CO_PAIS])
GO
ALTER TABLE [dbo].[TMAUXI_CORP] ADD CONSTRAINT [FK__TMAUXI_CO__CO_UB__30AE302A] FOREIGN KEY ([CO_UBIC_GEOG]) REFERENCES [dbo].[TTUBIC_GEOG] ([CO_UBIC_GEOG])
GO
ALTER TABLE [dbo].[TMAUXI_CORP] ADD CONSTRAINT [FK__TMAUXI_CO__TI_AU__3296789C] FOREIGN KEY ([TI_AUXI_CORP]) REFERENCES [dbo].[TTAUXI_CORP] ([TI_AUXI_CORP])
GO
ALTER TABLE [dbo].[TMAUXI_CORP] ADD CONSTRAINT [FK__TMAUXI_CO__TI_SI__2FBA0BF1] FOREIGN KEY ([TI_SITU]) REFERENCES [dbo].[TTSITU] ([TI_SITU])
GO
GRANT SELECT ON  [dbo].[TMAUXI_CORP] TO [public]
GRANT INSERT ON  [dbo].[TMAUXI_CORP] TO [public]
GRANT DELETE ON  [dbo].[TMAUXI_CORP] TO [public]
GRANT UPDATE ON  [dbo].[TMAUXI_CORP] TO [public]
GO
